﻿@using System.Data
@using LiuYan.Web.Areas.Mall.Controllers
@{
    Layout = null;
    Layout = "~/Areas/Mall/Views/Shared/MallLayout.cshtml";
    DataTable table = ViewData["goodsort"] as DataTable;
    DataTable rxgood = ViewData["rxgood"] as DataTable;
}

<div class="search">
    <div class="search_l">
        <input type="text" id="s_text" />
    </div> 
    <div class="search_r">
        <img src="/Images/seach.jpg" onclick="search()" />
    </div>
</div>
<div class="rx_tj">
    <p>热销推荐</p>
    @{
        foreach (DataRow row in rxgood.Rows)
        {
            <a href="@Url.Action("GoodDetail",new{gid=row["GId"]})">
                <img src="@row["Img1"]" />
                <p>@Html.Raw(row["Name"].ToString().Length > 8 ? row["Name"].ToString().Substring(0, 8) + "…" : row["Name"]) </p>
                <p style="color: #cc3333;">￥@Convert.ToDouble(row["Price"])</p>
            </a>
        }
    }
</div>


<div class="index_sort">
    @{
        foreach (DataRow row in table.Rows)
        {
            
            <a href="@Url.Action("Goods","Goods",new{id=row["Id"]})">
                <img src="@row["Img"]" />
                <div>
                    <p class="index_name">@row["Name"]</p>
                    <p class="index_name_mc">@row["Des"]</p>
                </div>
            </a>
        }
    }
</div>



<div style="width: 100%;height: 80px;"></div>

<script>
   
    function search() {
        var str = $("#s_text").val();
        if (str == "") {
            alert("请输入商品名称！");
            return false;
        }
        location.href = "@Url.Action("Index","Search")?str=" + encodeURIComponent(str);
    }

</script>